package com.gy.def.service.impl;

import com.gy.def.dataobject.CourseTable;
import com.gy.def.repository.CourseRepository;
import com.gy.def.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class CourseImpl implements CourseService {
  @Autowired
  private CourseRepository courseRepository;

  @Override
  public CourseTable save(CourseTable ct) {
    return courseRepository.save(ct);
  }

  @Override
  public CourseTable findByCourseNameAndIsDelete(String courseName, int isDelete) {
    return courseRepository.findByCourseNameAndIsDelete(courseName, isDelete);
  }

  @Override
  public Page<CourseTable> findByIsDelete(int isDelete, Pageable pageable) {
    return courseRepository.findByIsDelete(isDelete, pageable);
  }

  @Override
  public CourseTable findByCourseId(String courseId) {
    return courseRepository.findByCourseId(courseId);
  }

}
